import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../extend/language/Language";
import { GButton } from "../../../../../com/mui/controls/GButton";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { PopupManager } from "../../../manager/PopupManager";
import { PulseSharedObject } from "../../player/PulseSharedObject";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { GCheckBox } from "../../../../../com/mui/controls/GCheckBox";
import { _isMutiWash } from "../../../../../this/_isMutiWash";
//class MountForsterReplacePanel
    
    export  class MountForsterReplacePanel extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            this.setSize(330, 155);
            this.titleHeight = 26;
            this.title = Language.getString(69900);
            return;
        }

        public get btnOK(): GButton
        {
            return this._btnOK;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            super.createDisposedChildrenImpl();
            ObjCreate.createBg(22, 36, 288, 110, this);
            this._btnOK = ObjCreate.createGButton(Language.getString(60233), 70, 85, 80, 26, this);
            this._btnOK.configEventListener(flash.events.MouseEvent.CLICK, this.onButtonClick);
            this._btnCancel = ObjCreate.createGButton(Language.getString(71551), 180, 85, 80, 26, this);
            this._btnCancel.configEventListener(flash.events.MouseEvent.CLICK, this.onButtonClick);
            this._checkBox = ObjCreate.createCheckBox(Language.getString(60709), 40, 116, 150, 20, this);
            this._checkBox.addEventListener(flash.events.Event.CHANGE, this.onBoxChange);
            this._resultText = ObjCreate.createTextField(Language.getString(71525), 35, 48, 265, 20, this, GlobalStyle.textFormatWhite);
            return;
        }

        protected /* override */ closeBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            PopupManager.removePopup(this);
            return;
        }

        protected onBoxChange(arg1: Object /* flash.events.Event */): void
        {
            PulseSharedObject.save("mountForsterReplacePanel", this._checkBox.selected);
            return;
        }

        public setResultText(arg1: string): void
        {
            this._resultText.htmlText = arg1;
            return;
        }

        public setWashType(arg1: Boolean): void
        {
            this._isMutiWash = arg1;
            return;
        }

        protected onButtonClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=arg1.target;
            switch (loc1) 
            {
                case this._btnOK:
                {
                    this.dispatchEvent(new DataEvent(EventName.MountForsterReplaceOkClick));
                    break;
                }
                case this._btnCancel:
                {
                    this.dispatchEvent(new DataEvent(EventName.MountForsterReplaceCancerClick, {"isMutiWash": _isMutiWash}));
                    break;
                }
            }
            PopupManager.removePopup(this);
            return;
        }

        protected /* override */ disposeImpl(arg1: Boolean=true): void
        {
            this._btnOK.dispose(arg1);
            this._btnCancel.dispose(arg1);
            this._resultText.dispose(arg1);
            this._resultText = null;
            super.disposeImpl(arg1);
            return;
        }

        /* internal */ /* var */_btnOK: GButton;

        /* internal */ /* var */_btnCancel: GButton;

        /* internal */ /* var */_resultText: GTextFiled;

        /* internal */ /* var */_checkBox: GCheckBox;

        /* internal */ /* var */_isMutiWash: Boolean=false;
    }
